package com.yh.manage.cms.service;

import com.lxw.framework.domain.cms.CmsConfig;
import com.lxw.framework.exception.CastException;
import com.lxw.framework.model.response.CommonCode;
import com.yh.manage.cms.dao.CmsConfigRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Optional;

@Service
public class CmsConfigService {

    @Autowired
    private CmsConfigRepository cmsConfigRepository;

    //根据id查询配置管理信息
	public CmsConfig getConfigById(String id){
        if (StringUtils.isEmpty(id)) {
            CastException.cast(CommonCode.VALIDATA);
        }
        Optional<CmsConfig> cmsConfig = cmsConfigRepository.findById(id);

        CmsConfig cmsConfig1 = cmsConfig.orElse(null);
        return cmsConfig1;
    }
}
